<template>
  <div class="container">
    <div class="center">
      <el-form label-position="left" label-width="80px">
        <el-form-item label="店铺编号:" class="item">
          <el-input class="input" v-model="formData.id" disabled></el-input>
        </el-form-item>
        <el-form-item label="店铺名称" class="item">
          <el-input class="input" v-model="formData.storeName"></el-input>
        </el-form-item>
        <el-form-item label="地址:" class="item">
          <el-input class="input" v-model="formData.address"></el-input>
        </el-form-item>
        <el-form-item label="类别:" class="item">
          <el-input class="input" v-model="formData.classification"></el-input>
        </el-form-item>
        <el-form-item label="描述:">
          <el-input
            class="input"
            type="textarea"
            maxlength="100"
            show-word-limit
            rows="5"
            v-model="formData.description"
          ></el-input>
        </el-form-item>
        <el-form-item label="注册时间:" class="item">
          <el-date-picker
            class="input"
            type="datetime"
            placeholder="选择日期时间"
            disabled
            v-model="formData.createTime"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="" class="item">
            <el-button type="primary" plain style="margin-left: 100px;width: 125px" @click="modify">  修改  </el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import { userAxios } from "../../common/network/request";
export default {
  data() {
    return {
      formData: {},
    };
  },
  methods: {
    modify() {
      userAxios({
        url: '/business/modifyStoreInfo',
        method: 'post',
        data: this.formData
      }).then(res => {
        if (res == 1) {
          this.$message.success('更新成功')
        }else {
          this.$message.error('更新失败')
        }
      })
    }
  },
  created() {
    userAxios({
      url: "/business/getStoreByBusinessId",
      method: "get",
    }).then((res) => {
      this.formData = res;
    });
  },
};
</script>

<style scoped>
.container {
  height: 100%;
}

.center {
  display: flex;
  flex-direction: column;
  height: 80%;
  width: 40%;
  margin: auto;
}

.item {
  flex: 1;
  /* border: 1px solid red; */
}

.input {
  width: 330px;
}
</style>